package com.example.littleSpider.myapplication.activity;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

import com.example.littleSpider.myapplication.R;
import com.example.littleSpider.myapplication.base.BaseActivity;
import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 选择收货地址的界面
 * Created by littleSpider on 2017/12/22.
 */

public class ManageAddressActivity extends BaseActivity{

    @BindView(R.id.ll_address_list)
    LinearLayout ll_address_list;
    @BindView(R.id.refresh_view)
    TwinklingRefreshLayout refreshView;

    @Override
    protected int getLayoutRes() {
        return R.layout.activity_manage_address;
    }

    @Override
    protected void initView() {
        refreshView.setPureScrollModeOn();
        for (int i = 0; i < 3; i++) {
            View view = LayoutInflater.from(this).inflate(R.layout.item_address, null);
            view.findViewById(R.id.ll_alter).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(ManageAddressActivity.this, ChangeAddressActivity.class);
                    startActivity(intent);
                }
            });
            view.findViewById(R.id.ll_delete).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                }
            });
            ll_address_list.addView(view);
        }
    }

    @Override
    protected void initData() {

    }

    @OnClick(R.id.rl_back)
    public void reBack(){
        finish();
    }

    @OnClick(R.id.tv_add_new)
    public void addNew(){
        Intent intent = new Intent(this, ChangeAddressActivity.class);
        intent.putExtra("title", getString(R.string.add_new_address));
        startActivity(intent);
    }

    @OnClick({R.id.ll_alter, R.id.ll_delete})
    public void operateAddress(View view){

    }
}
